subroutine wenojs3(mx,my,UU,Ufl,Ufr,Ugl,Ugr)
use var
implicit none
    real(8) UU(5,1+Klx:gridsx+krx,1+Kly:gridsy+kry)
    real(8) Ufl(5,0:mx,0:my),Ufr(5,0:mx,0:my)
    real(8) Ugl(5,0:mx,0:my),Ugr(5,0:mx,0:my)
    real(8) beta1,beta2,w1,ee
	integer i,j,k,mx,my

!$omp parallel private(i,j,k,beta1,beta2,w1)
    !$omp do
    ee=10E-40
    do i=0,mx
        do j=1,my
            do k=1,5
                beta1=(uu(k,i,j)-uu(k,i-1,j))**2
                beta2=(uu(k,i+1,j)-uu(k,i,j))**2
                w1=0.5d0/(1.d0+2.d0*((beta1+ee)/(beta2+ee))**2)
                ufl(k,i,j)=(uu(k,i,j)+uu(k,i+1,j))/2.d0+&
                           w1*(uu(k,i,j)*2.d0-uu(k,i-1,j)-uu(k,i+1,j))

                beta1=(uu(k,i+1,j)-uu(k,i+2,j))**2
                beta2=(uu(k,i+1,j)-uu(k,i,j))**2
                w1=0.5d0/(1.d0+2.d0*((beta1+ee)/(beta2+ee))**2)
                ufr(k,i,j)=(uu(k,i,j)+uu(k,i+1,j))/2.d0+&
                           w1*(uu(k,i+1,j)*2.d0-uu(k,i,j)-uu(k,i+2,j))
            enddo
        enddo
    enddo
    !$omp end do
    !$omp do
    do j=0,my
        do i=1,mx
            do k=1,5
                beta1=(uu(k,i,j)-uu(k,i,j-1))**2
                beta2=(uu(k,i,j+1)-uu(k,i,j))**2
                w1=0.5d0/(1.d0+2.d0*((beta1+ee)/(beta2+ee))**2)
                ugl(k,i,j)=(uu(k,i,j)+uu(k,i,j+1))/2.d0+&
                           w1*(uu(k,i,j)*2.d0-uu(k,i,j-1)-uu(k,i,j+1))

                beta1=(uu(k,i,j+1)-uu(k,i,j+2))**2
                beta2=(uu(k,i,j+1)-uu(k,i,j))**2
                w1=0.5d0/(1.d0+2.d0*((beta1+ee)/(beta2+ee))**2)
                ugr(k,i,j)=(uu(k,i,j)+uu(k,i,j+1))/2.d0+&
                           w1*(uu(k,i,j+1)*2.d0-uu(k,i,j)-uu(k,i,j+2))
            enddo
        enddo
    enddo
    !$omp end do
!$omp end parallel

end subroutine wenojs3